package com.reebake.ideal.security.config;

import com.reebake.ideal.security.core.AuthenticationFactorConvertor;
import com.reebake.ideal.security.handler.*;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class AuthenticationServerBasicConfig {

    @Bean
    LoginAuthenticationEventHandler loginAuthenticationEventHandler() {
        return new LoginAuthenticationEventHandler();
    }

    @Bean
    @ConditionalOnMissingBean
    AuthenticationCaptchaHandler authenticationCaptchaHandler() {
        return new AuthenticationCaptchaHandler();
    }

    @Bean
    @ConditionalOnMissingBean
    UsernameAuthenticationFactorConvertor usernameAuthenticationFactorConvertor() {
        return new UsernameAuthenticationFactorConvertor();
    }

    @Bean
    @ConditionalOnMissingBean
    CodeAuthenticationFactorConvertor codeAuthenticationFactorConvertor() {
        return new CodeAuthenticationFactorConvertor();
    }

    @Bean
    @ConditionalOnMissingBean
    QrcodeAuthenticationFactorConvertor qrcodeAuthenticationFactorConvertor() {
        return new QrcodeAuthenticationFactorConvertor();
    }
}
